﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace DLL.PicNews
{
	/// <summary>
	/// 图片新闻视图控制类
	/// </summary>
	/// <![CDATA[2014-8-7 17:52:59]]>
	public class View : DLL.ShowLayer.FormView
	{
		private Component clsthisComp;

		#region 添加、修改
		private TextBox tbDate = new TextBox();
		private FileUpload fUploadPic = new FileUpload();
		private FileUpload fUploadFile = new FileUpload();
		#endregion 添加、修改

		#region 查询

		#endregion 查询

		#region 浏览

		#endregion 浏览

		#region 构造函数
		/// <summary>
		/// 视图类构造函数
		/// </summary>
		/// <![CDATA[2014-8-19 14:46:00]]>
		public View(System.Web.UI.Page page)
			: base(page)
		{
			clsthisComp = new Component(page);

			clsComp = clsthisComp;

			tbDate.Attributes.Add("onClick", "popUpCalendar(this, this, 'yyyy-mm-dd')");
			tbDate.Text = System.DateTime.Now.ToShortDateString();
			listAddEdit.Add(new TonyNet4V1.Structs.TitleControlEntity("时间", "TextBox", tbDate, "string", "strShowDate"));
			listAddEdit.Add(new TonyNet4V1.Structs.TitleControlEntity("图片", "FileUpload", fUploadPic, "", ""));
			listAddEdit.Add(new TonyNet4V1.Structs.TitleControlEntity("新闻", "FileUpload", fUploadFile, "", ""));
		}
		#endregion 构造函数

		#region 类型转换

		protected override TonyNet4V1.EntityBase GetEntity()
		{
			return new Entity();
		}

		protected override TonyNet4V1.QueryEntityBase GetQuery()
		{
			return new QueryEntity();
		}

		protected override TonyNet4V1.ComponentBase GetComponent()
		{
			return clsthisComp;
		}

		#endregion 类型转换

		/// <summary>
		/// 添加
		/// </summary>
		/// <![CDATA[2014-8-19 16:32:20]]>
		/// <returns></returns>
		public override bool Add()
		{
			Entity clsAdd = new Entity();

			clsAdd.ShowDate = tbDate.Text;
			clsAdd.UserID = nUserID;
			clsAdd.DepartmentID = nDepartmentID;

			return clsthisComp.Add(clsAdd, fUploadPic, fUploadFile);
			//return base.Add();
		}
	}
}
